﻿using System;
using System.Collections.Generic;
using HuwmanCode.ServiceProcess;
using HuwmanCode.Diagnostics.Logging;
using System.Diagnostics;

namespace HuwmanCode.Samples.CSWindowsService
{
    static class Program
    {
        static void Main()
        {
            Logger.CreateDefaultLogger(() => new ILogWriter[] { new ConsoleEventWriter(), new WindowsEventWriter() }, new TraceEventWriter());

            Action<string, int> recover = (serviceName, failCount) =>
                { 
                    Debugger.Launch();
                    Debug.WriteLine(string.Format("{0} has failed {1} time(s)!",
                        serviceName, failCount));

                };
            WindowsServiceBase.Run(recover);
        }
    }
}
